<?xml version="1.0"?>

<st-source>
<time-stamp>From VisualWorks® NonCommercial, 7.6 of March 3, 2008 on March 12, 2009 at 4:08:29 pm</time-stamp>


<class>
<name>InvoiceTest</name>
<environment>SupplyChain</environment>
<super>XProgramming.SUnit.TestCase</super>
<private>false</private>
<indexed-type>none</indexed-type>
<inst-vars>items i1 i2 i3 i4 i5 invoice </inst-vars>
<class-inst-vars></class-inst-vars>
<imports></imports>
<category></category>
<attributes>
<package>SupplyChain</package>
</attributes>
</class>

<comment>
<class-id>SupplyChain.InvoiceTest</class-id>
<body>Tests the capability of the invoice to hold items.

Instance Variables:
	i1	&lt;Object&gt;	a test Item
	i2	&lt;Object&gt;	a test Item
	i3	&lt;Object&gt;	a test Item
	i4	&lt;Object&gt;	a test Item
	i5	&lt;Object&gt;	a test Item
	invoice	&lt;Invoice&gt;	a test invoice
	items	&lt;SortedCollection&gt;	a list of items to insert into the invoice

</body>
</comment>

<methods>
<class-id>SupplyChain.InvoiceTest</class-id> <category>initialize-release</category>

<body package="SupplyChain" selector="addAllItems">addAllItems
   	"utility method to add all the items to the inventory"

  	items add: i1.
 	items add: i2.
 	items add: i3.
 	items add: i4.
   	items add: i5.

	^self</body>

<body package="SupplyChain" selector="initialize">initialize
	"Initialize a newly created instance. This method must answer the receiver."

	items := nil.
	

	i1 := nil.
	i2 := nil.
	i3 := nil.
	i4 := nil.
	i5 := nil.
	^self</body>
</methods>

<methods>
<class-id>SupplyChain.InvoiceTest</class-id> <category>accessing</category>

<body package="SupplyChain" selector="i1">i1
	
	^i1</body>

<body package="SupplyChain" selector="i1:">i1: anItem
	
	i1 := anItem.
	^self</body>

<body package="SupplyChain" selector="i2">i2
	
	^i2</body>

<body package="SupplyChain" selector="i2:">i2: anItem
	
	i2 := anItem.
	^self</body>

<body package="SupplyChain" selector="i3">i3
	
	^i3</body>

<body package="SupplyChain" selector="i3:">i3: anItem
	
	i3 := anItem.
	^self</body>

<body package="SupplyChain" selector="i4">i4
	
	^i4</body>

<body package="SupplyChain" selector="i4:">i4: anItem
	
	i4 := anItem.
	^self</body>

<body package="SupplyChain" selector="i5">i5
	
	^i5</body>

<body package="SupplyChain" selector="i5:">i5: anItem
	
	i5 := anItem.
	^self</body>

<body package="SupplyChain" selector="items">items
	
	^items</body>

<body package="SupplyChain" selector="items:">items: someItems
	
	items := someItems.
	^self</body>
</methods>

<methods>
<class-id>SupplyChain.InvoiceTest</class-id> <category>running</category>

<body package="SupplyChain" selector="setUp">setUp
   "Create test objects.  This is called before every individual test"

   invoice := Invoice new.
   i1 := Item named: 'Video Game' sku:'89X999'.
   i2 := Item named: 'TV' sku: '99Z837'.
   i3 := Item named: 'VCR' sku: '54Y3632'.
   i4 := Item named: 'PC' sku: '01P6373'.
   i5 := Item named: 'Laptop' sku: '11F4732'.
   

   ^self</body>

<body package="SupplyChain" selector="testInvoice">testInvoice

	items:= OrderedCollection new.

	items add: i1.
	items add: i2.
	items add: i3.
	items add: i4.
	items add: i5.
	
	invoice itemList: items.
     
      self assert: (invoice itemList includes: i1).
      self assert: (invoice itemList includes: i2).
	
	^self</body>
</methods>

</st-source>
